package com.example.tests;

public class ContactData implements Comparable<ContactData> {
	private String firstName;
	private String lastName;
	private String address;
	private String homePhoneNumber;
	private String mobilePhoneNumber;
	private String workPhoneNumber;
	private String firstEmail;
	private String secondEmail;
	private String bday;
	private String bmonth;
	private String birthYear;
	private String address2;
	private String homePhone2;
	public String newGroup;
	
	public ContactData() {
	}

	@Override
	public String toString() {
		return "ContactData [firstName=" + firstName + ", lastName=" + lastName
				+ "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		//result = prime * result		+ ((firstName == null) ? 0 : firstName.hashCode());
		//result = prime * result       + ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		return true;
	}

	@Override
	public int compareTo(ContactData other) {
		if (this.lastName.toLowerCase().compareTo(other.lastName.toLowerCase()) != 0){
			return this.lastName.toLowerCase().compareTo(other.lastName.toLowerCase());
		}
			return this.firstName.toLowerCase().compareTo(other.firstName.toLowerCase());	
	}

//-------------------------------Setters----------------------------------------------
	
	public ContactData withFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactData withLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}

	public ContactData withAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactData withHomePhoneNumber(String homePhoneNumber) {
		this.homePhoneNumber = homePhoneNumber;
		return this;
	}

	public ContactData withMobilePhoneNumber(String mobilePhoneNumber) {
		this.mobilePhoneNumber = mobilePhoneNumber;
		return this;
	}

	public ContactData withWorkPhoneNumber(String workPhoneNumber) {
		this.workPhoneNumber = workPhoneNumber;
		return this;
	}

	public ContactData withFirstEmail(String firstEmail) {
		this.firstEmail = firstEmail;
		return this;
	}

	public ContactData withSecondEmail(String secondEmail) {
		this.secondEmail = secondEmail;
		return this;
	}

	public ContactData withAddress2(String address2) {
		this.address2 = address2;
		return this;
	}

	public ContactData withHomePhone2(String homePhone2) {
		this.homePhone2 = homePhone2;
		return this;
	}

	public ContactData withbirthYear(String birthYear) {	
		this.birthYear = birthYear;
		return this;
	}
	
	public ContactData withBmonth(String bmonth) {
		this.bmonth = bmonth;
		return this;
	}
	
	public ContactData withBday(String bday) {
		this.bday = bday;
		return this;
	}

//---------------------------------------Getters--------------------------------------
	
	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getAddress() {
		return address;
	}

	public String getHomePhoneNumber() {
		return homePhoneNumber;
	}

	public String getMobilePhoneNumber() {
		return mobilePhoneNumber;
	}

	public String getWorkPhoneNumber() {
		return workPhoneNumber;
	}

	public String getFirstEmail() {
		return firstEmail;
	}

	public String getSecondEmail() {
		return secondEmail;
	}

	public String getAddress2() {
		return address2;
	}

	public String getHomePhone2() {
		return homePhone2;
	}

	public String getBirthYear() {
		return birthYear;
	}

	public String getBmonth() {
		return bmonth;
	}

	public String getBday() {
		return bday;
	}


}